package 面试经典150题.数学;

/**
 * @author tmh
 * @date 2024/6/16 14:15
 * @description
 */
public class T9回文数 {
    public boolean isPalindrome(int x) {
        //整数变化为字符串
        String s = String.valueOf(x);
        for (int i = 0, j = s.length() - 1; i < j; i++, j--) {
            if (s.charAt(i) != s.charAt(j)) {
                return false;
            }
        }
        return true;
    }
}